//
//  ExchgeRateCulTowCell.m
//  CenturyCity
//
//  Created by beisheng03 on 2017/12/22.
//  Copyright © 2017年 beisheng. All rights reserved.
//

#import "ExchgeRateCulTowCell.h"

@interface ExchgeRateCulTowCell ()
@property (weak, nonatomic) IBOutlet UIImageView *leftImageView;
@property (weak, nonatomic) IBOutlet UILabel *leftLabel;
@property (weak, nonatomic) IBOutlet UILabel *rightTopLabel;
@property (weak, nonatomic) IBOutlet UILabel *rightBottomLabel;

@end


@implementation ExchgeRateCulTowCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.leftLabel.font = MYFONT(16);
    
    self.rightTopLabel.font = MYFONT(19);
    
    self.rightBottomLabel.font = MYFONT(11);
    
    self.rightTopLabel.text = @"0.00";
    
    
    
    self.rightBottomLabel.textColor = darkGray;
    
    [self.leftImageView sd_setImageWithURL:[NSURL URLWithString:@"http://e.hiphotos.baidu.com/zhidao/pic/item/d50735fae6cd7b89d2f399e50d2442a7d9330e3c.jpg"] placeholderImage:nil];

    // Initialization code
}


- (void)setModel:(ExchangRateModel *)model{
    
    _model = model;
    
    self.leftImageView.hidden = NO;
    
    NSLog(@"%@",_model.exchangeRate);
    
    self.rightTopLabel.text = _model.exchangeRate.length > 0 ? _model.exchangeRate : @"0.00";
    
    
    if ([_model.bottomImageName isEqualToString:@"CNY"]) {
        
        self.leftLabel.text = @"人民币 ¥";
        
        self.leftImageView.image = [UIImage imageNamed:@"CNY"];
        
    } else if ([_model.bottomImageName isEqualToString:@"EUR"]){
        
        self.leftLabel.text = @"欧元 €";
        
        self.leftImageView.image = [UIImage imageNamed:@"EUR"];

        
    }else if ([_model.bottomImageName isEqualToString:@"USD"]){
        
        self.leftLabel.text = @"美元 $";
        
        self.leftImageView.image = [UIImage imageNamed:@"USD"];

        
    }else if ([_model.bottomImageName isEqualToString:@"JPY"]){
        
        self.leftLabel.text = @"日元 JPY￥";
        
        self.leftImageView.image = [UIImage imageNamed:@"JPY"];

        
    }else if ([_model.bottomImageName isEqualToString:@"GBP"]){
        
        self.leftLabel.text = @"英镑 ￡";
        
        self.leftImageView.image = [UIImage imageNamed:@"GBP"];

        
    }else if ([_model.bottomImageName isEqualToString:@"HKD"]){
        
        self.leftLabel.text = @"港币 HK$ ";
        
        self.leftImageView.image = [UIImage imageNamed:@"HKD"];

        
    }else if ([_model.bottomImageName isEqualToString:@"PHP"]){
        
        self.leftLabel.text = @"比索 PHP ";
        
        self.leftImageView.image = [UIImage imageNamed:@"PHP"];
        
        
    }else{
        
        self.leftLabel.text = @"";
        
        self.leftImageView.hidden = YES;
        
    }
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
